<?php

namespace app\api\controller\meet\product;

use app\common\controller\Api;

/**
 * 分类接口
 */
class Category extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     *
     * @var \app\common\model\meet\Category
     */
    protected $model = null;

    public function _initialize()
    {
        parent::_initialize();

        $this->model = new \app\common\model\meet\Category();
    }

    public function index()
    {
        $pid = $this->request->get('pid/d', 0);

        $condition = [
            'status' => $this->model::STATUS_NORMAL,
            'pid' => $pid
        ];

        $list = $this->model->where($condition)->field('id,name,nickname,image,keywords')->order('weigh', 'desc')->select();

        $this->success('', ['list' => $list]);
    }
}
